package org.shoukaiseki.inittable.utils;

import org.shoukaiseki.inittable.domain.TableConstraintForeignKeyInfo;
import org.shoukaiseki.inittable.domain.TableIndexInfo;

/**
 *
 **/
public class TableConstraintForeignKeyInfoBuilder extends TableConstraintInfoBuilder{

    /**
     * 限制名称,可根据改名称判断限制是否存在
     */
    private String constraintName;

    /**
     * 当前表的关联字段
     */
    private String columnName;

    /**
     * 关联的表名
     */
    private String relationTableName;

    /**
     * 关联表的的属性名
     */
    private String relationColumnName;

    private TableConstraintForeignKeyInfoBuilder(){

    }

    public static TableConstraintForeignKeyInfoBuilder constraintName(String constraintName){
        TableConstraintForeignKeyInfoBuilder builder = new TableConstraintForeignKeyInfoBuilder();
        builder.constraintName=constraintName;
        return builder;
    }

    public TableConstraintForeignKeyInfoBuilder columnName(String columnName){
       this.columnName=columnName;
        return this;
    }

    public TableConstraintForeignKeyInfoBuilder relationTableName(String relationTableName){
        this.relationTableName=relationTableName;
        return this;
    }

    public TableConstraintForeignKeyInfoBuilder relationColumnName(String relationColumnName){
        this.relationColumnName=relationColumnName;
        return this;
    }

    public TableConstraintForeignKeyInfo build() {
        TableConstraintForeignKeyInfo info = new TableConstraintForeignKeyInfo();
        info.setConstraintName(constraintName);
        info.setColumnName(columnName);
        info.setRelationTableName(relationTableName);
        info.setRelationColumnName(relationColumnName);
        return info;
    }

}
